package com.xn.app.muying.adpter;

import android.content.Context;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.xn.app.muying.R;
import com.xn.app.muying.bean.HomeKePuBean;
import com.xn.app.muying.util.HttpUtil;

import java.util.ArrayList;

/**
 * Created by Administrator on 2016/10/14.
 */
public class HomeXuanChuanGridViewAdapter extends BaseAdapter{
    private final LayoutInflater inflater;
    private Context context;
    private ArrayList<HomeKePuBean> list = new ArrayList<>();
    public HomeXuanChuanGridViewAdapter(Context context) {
        super();
        this.context = context;
        inflater = LayoutInflater.from(context);
    }
    public void getData(ArrayList<HomeKePuBean> data) {
        this.list.addAll(data);
        notifyDataSetChanged();
    }
    @Override
    public int getCount() {

        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder=null;
        if (view==null){
            view = inflater.inflate(R.layout.home_kepu_gridview,null);
            holder = new ViewHolder();
            holder.tv = (TextView) view.findViewById(R.id.gridview_tv);

            view.setTag(holder);
        }else {
            holder = (ViewHolder) view.getTag();
        }
        HomeKePuBean bean = list.get(i);
        return view;

    }

    class ViewHolder {
        TextView tv;
    }
}
